from django.urls import path, include
from users.views import UserViewSet, DeptViewSet, GroupViewSet, PermissionViewSet
from rest_framework import routers
# 导入 simplejwt验证视图类TokenObtainPairView
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView

router = routers.DefaultRouter()
router.register(r'users', UserViewSet)
router.register(r'depts', DeptViewSet)
router.register(r'groups', GroupViewSet)
router.register(r'permissions', PermissionViewSet)
urlpatterns = [
    path('', include(router.urls)),
    path('login/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
    path('login/refresh/', TokenRefreshView.as_view(), name='token_refresh')
]